<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Title</title>
</head>
<body>
<table border="1">
    <caption></caption>
    <tr>
        <td>名字:</td>
        <td id="name_td"></td>
    </tr>
    <tr>
        <td>照片:</td>
        <td><img src="" alt="" style="width: 100px"></td>
    </tr>
    <tr>
        <td>年龄:</td>
        <td id="age_td"></td>
    </tr>
    <tr>
        <td>工作:</td>
        <td id="job_td"></td>
    </tr>
    <tr>
        <td>好友:</td>
        <td>
            <ul>
                <li>xxx</li>
                <li>xxx</li>
                <li>xxx</li>
            </ul>
        </td>
    </tr>
</table>
<input type="button" value="请求数据">

<!--引入jQuery框架-->
<script src="https://cdn.staticfile.org/jquery/2.1.1/jquery.min.js"></script>
<script>
    //给按钮添加点击事件
    $("input").click(function () {
        //准备一个对象    模拟是从服务器请求到的数据
        let person = {
            name:"美女",
            age:18,
            url:"e.jpg",
            job:"模特",
            friends:["张学友","黎明","赵本山"]}
        //把数据展示到页面中'
        $("#name_td").text(person.name);
        $("#age_td").text(person.age);
        $("#job_td").text(person.job);
        $("img").attr("src",person.url);
        //删除所有li
        $("li").remove();
        //遍历好友
        for (let friend of person.friends) {
            //创建li
            let li = $("<li></li>");
            li.text(friend);
            //把li添加到ul里面
            $("ul").append(li);
        }
    })
</script>
</body>
</html>